package com.qingcheng.service;

import com.alibaba.dubbo.config.annotation.Reference;
import com.alibaba.dubbo.config.annotation.Service;
import com.qingcheng.pojo.seckill.SeckillGoods;
import com.qingcheng.service.seckill.SeckillGoodsService;
import com.qingcheng.util.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;

import java.util.List;

/**
 * @Author: LDeng
 * @Date: 2020-07-14 13:53
 */

@Service
public class SeckillGoodsServiceImpl implements SeckillGoodsService {

    @Autowired
    private RedisTemplate redisTemplate;

    public List<SeckillGoods> list(String time) {

        String key="SeckillGoods_"+time;
        return redisTemplate.boundHashOps(key).values();

    }

    public SeckillGoods one(String time, Long id) {
        return  (SeckillGoods) redisTemplate.boundHashOps("SeckillGoods_" + time).get(id);
    }
}
